//
//  SMOptionalTitleView.m
//  lishiminOC
//
//  Created by p2p on 16/10/12.
//  Copyright © 2016年 p2p. All rights reserved.
//

#import "SMOptionalTitleView.h"


@interface SMOptionalTitleView()
@property (nonatomic,strong)UILabel *textName;
@property (nonatomic,strong)UILabel *choosePrice;
@property (nonatomic,strong)UILabel *newestTextPrice;
@end
@implementation SMOptionalTitleView

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.backgroundColor = [UIColor orangeColor];
        UILabel *labelName = [[UILabel alloc]init];
        labelName.text = @"藏品";
        labelName.textColor = [UIColor redColor];
        labelName.font = [UIFont systemFontOfSize:14];
        labelName.textAlignment = NSTextAlignmentLeft;
        [self addSubview:labelName];
        self.textName = labelName;
        
        UILabel *chooseLabel = [[UILabel alloc]init];
        chooseLabel.text = @"选入价";
        chooseLabel.textColor = [UIColor redColor];
        chooseLabel.font = [UIFont systemFontOfSize:14];
        chooseLabel.textAlignment = NSTextAlignmentLeft;
        [self addSubview:chooseLabel];
        self.choosePrice = chooseLabel;
        
        UILabel *newestLabel = [[UILabel alloc]init];
        newestLabel.text = @"最新价";
        newestLabel.textColor = [UIColor redColor];
        newestLabel.font = [UIFont systemFontOfSize:14];
        newestLabel.textAlignment = NSTextAlignmentRight;
        [self addSubview:newestLabel];
        self.newestTextPrice = newestLabel;
        
    }
    
    return self;
}

- (void)layoutSubviews{
    
    __weak __typeof(&*self)weakSelf = self;
    [self.textName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(@100);
        make.left.equalTo(weakSelf.mas_left).with.offset(15);
        make.top.equalTo(weakSelf.mas_top).with.offset(5);
        make.bottom.equalTo(weakSelf.mas_bottom).with.offset(-5);
        
    }];
    
    [self.choosePrice mas_makeConstraints:^(MASConstraintMaker *make) {
        //
        make.left.equalTo(weakSelf.textName.mas_right).with.offset(2);
        make.top.equalTo(weakSelf.mas_top).with.offset(5);
        make.bottom.equalTo(weakSelf.mas_bottom).with.offset(-5);
        make.right.equalTo(weakSelf.newestTextPrice.mas_left);
        make.width.equalTo(weakSelf.newestTextPrice.mas_width);
    }];
    
    [self.newestTextPrice mas_makeConstraints:^(MASConstraintMaker *make) {
        //
        make.left.equalTo(weakSelf.choosePrice.mas_right);
        make.top.equalTo(weakSelf.mas_top).with.offset(5);
        make.bottom.equalTo(weakSelf.mas_bottom).with.offset(-5);
        make.right.equalTo(weakSelf.mas_right).with.offset(-15);
        make.width.equalTo(weakSelf.choosePrice.mas_width);
    }];
    
    
}

@end
